package com.fh.controller;


import com.fh.service.ProductCommentsService;
import com.fh.service.ProductParamsService;
import com.fh.vo.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/comment")
@CrossOrigin
@Api(tags = "评论")
public class ProductCommentsController {

@Resource
private ProductCommentsService productCommentsService;

    @ApiOperation("分页")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "string",name = "productId", value = "id",required =
                    true),
            @ApiImplicitParam(dataType = "int",name = "pageNum", value = "当前页",required =
                    true),
            @ApiImplicitParam(dataType = "int",name = "limit", value = "每页显示条数",required =
                    true)
    })
@GetMapping("list-comment/{productId}")
public  ResultVo selectComment(@PathVariable("productId") String productId,Integer pageNum,Integer limit){
    return  productCommentsService.selectComment(productId,pageNum,limit);
}

    @GetMapping("list-commentType/{productId}")
    public  ResultVo selectCommentType(@PathVariable("productId") String productId){
        return  productCommentsService.selectCommentType(productId);
    }


}
